home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_c / 13h_kit / keyboard.hpp < prev    next >
C/C++ Source or Header  |  1991-07-04  |  4KB  |  79 lines

  1. // KEYBOARD.HPP ************************************************************
  2. // module for low level filtered and unfiltered keyboard i/o.              *
  3. // Copyright 1991 by the Gamers Programming Workshop, a function of the    *
  4. // GAMERS forum, Compuserve. For more info e-mail 76605,2346.              *
  5. //                                                                         *
  6. // License is granted for use or modification of this code as long as      *
  7. // this notice remains intact, and all improvements are listed in the      *
  8. // version history below, and uploaded to the GAMERS forum. This code      *
  9. // may not be used for any commercial purpose.                             *
  10. //                                                                         *
  11. //**************************************************************************
  12.  
  13. //**************************************************************************
  14. // Version history:                                                        *
  15. //                                                                         *
  16. // Version 1.0                                                             *
  17. // Developed: May 30, 1991                                                 *
  18. // Author:    Mark Betz, 76605, 2346                                       *
  19. // Last update: July 5, 1991                                               *
  20. //**************************************************************************
  21.  
  22. enum boolean {false,true};
  23.  
  24. // keyboard constants for special keys *************************************
  25. // prefixes: C_  : Ctrl and key
  26. //           S_  : Shift and key
  27. //           A_  : Alt and key      example: A_F2 = alt-f2
  28. // *************************************************************************
  29.  
  30. enum extnd {F1=59,F2,F3,F4,F5,F6,F7,F8,F9,F10,
  31.             F11=133,F12,
  32.             S_F1=84,S_F2,S_F3,S_F4,S_F5,S_F6,S_F7,S_F8,S_F9,S_F10,
  33.             S_F11=135,S_F12,
  34.             C_F1=94,C_F2,C_F3,C_F4,C_F5,C_F6,C_F7,C_F8,C_F9,C_F10,
  35.             C_F11=137,C_F12,
  36.             A_F1=104,A_F2,A_F3,A_F4,A_F5,A_F6,A_F7,A_F8,A_F9,A_F10,
  37.             A_F11=139,A_F12,
  38.             S_TAB=15,
  39.             HOME=71,UP_ARR,PG_UP,LT_ARR=75,RT_ARR=77,END=79,DN_ARR,
  40.             PG_DN,INS,DEL,
  41.             C_PRTSC=114,C_LT_ARR,C_RT_ARR,C_END,C_PG_DN,C_HOME,
  42.             C_PG_UP=132, NO_EXT=0};
  43.  
  44. // *************************************************************************
  45. // mask types passed to getfilteredkey() to select keymask. Masks operate
  46. // as follows:  U_CASE   - returns only upper case characters
  47. //                L_CASE   - returns only lower case characters
  48. //                B_CASE   - returns characters of both cases
  49. //                NUMBER   - returns only numbers
  50. //                FUNCT    - returns only function keys
  51. //                CURSOR   - returns only cursor positioning keys
  52. //              PUNCT    - returns only punctuation marks
  53. //              ESC      - returns only the escape key
  54. //
  55. // the masks can be combined with a logical OR in the call, for example:
  56. //
  57. // if(getfilteredkey(&this_event,U_CASE|NUMBER|FUNCT))
  58. //
  59. // will return true if the key pressed was an upper case character, a
  60. // number, or a function key. If true, the key's ascii code and scan
  61. // value are in struct key_event this_event.
  62. // *************************************************************************
  63.  
  64. const char UCASE = 0x1;
  65. const char LCASE = 0x2;
  66. const char BCASE = 0x4;
  67. const char NUMBER = 0x8;
  68. const char FUNCT  = 0x10;
  69. const char CURSOR = 0x20;
  70. const char PUNCT  = 0x40;
  71. const char ESC   = 0x80;
  72.  
  73. // function prototypes *****************************************************
  74.  
  75. extern void getkey(char *key, extnd *scan);
  76. extern boolean getfilteredkey(char mask, char *key, extnd *scan);
  77. extern void stuffbuffer(char key, extnd scan);
  78. extern void flushBuffer(char *buf);
  79.